package com.dong.thread.threadbasic;

/**
 * 缓存行对齐
 * 缓存行64个字节是CPU同步的基本单位，缓存行隔离会比伪共享效率要高
 * Disruptor
 *
 * @author by jiweidong on 2021/11/23.
 */
public class T13_Visibility_Volatile {

    private static volatile boolean running = true;
//    private static boolean running = true;

    private static void m() {
        System.out.println("m start");
        while (running) {
            //System.out.println("hello");
        }
        System.out.println("m end!");
    }

    public static void main(String[] args) {

        new Thread(T13_Visibility_Volatile::m, "t1").start();

        SleepHelper.sleepSeconds(1);

        running = false;
    }
}
